package STUDENT.TRINHQUANGXUANDUC.BASIC.CAUTRUCLAPTRINH;

import java.util.Scanner;

public class BAI2 {
	public static void main(String[] args) {
		String valueString = null;
		int a =0 , b = 0, pheptoan;
		Scanner sc = new Scanner(System.in);
		do {
			System.out.println("Nhap gia tri a:");
			valueString = sc.nextLine();
			if (valueString.isEmpty()) {
				System.out.println("Ban chua nhap gia tri vui long kiem tra lai");
			}
			else {
				a = Integer.parseInt(valueString);
			}
		} while (valueString.isEmpty());
		sc = new Scanner(System.in);
		do {
			System.out.println("Nhap gia tri b:");
			valueString = sc.nextLine();
			if (valueString.isEmpty()) {
				System.out.println("Ban chua nhap gia tri vui long kiem tra lai");
			}
			else {
				b = Integer.parseInt(valueString);
			}
			
			
		} while (valueString.isEmpty());
		if (a != 0 || b == 0 ) {
			System.out.println("Khong the chia cho khong");
		}
		if (a==0 && b == 0) {
			System.out.println("Khong co ket qua");
		}
		else {
			System.out.println("Xin moi chon phep toan:");
			System.out.println("1.cong");
			System.out.println("2.tru");
			System.out.println("3.nhan");
			System.out.println("4.chia");
			sc = new Scanner(System.in);
			pheptoan = sc.nextInt();
			switch (pheptoan) {
			case 1:
				System.out.println("Ket qua " + a + "+" + b + "la:" + a + b);
				break;
			case 2:
				System.out.println("ket qua" + a +"-" +b +"la:"+(a-b));
				break;
			case 3:
				System.out.println("Ket qua " + a + "*" + b + "la:" + a * b);
				break;
				case 4:
					System.out.println("Ket qua " + a +"/"+b+"la:" + a/b);
			default:
				System.out.println("Ban chua chon phep tinh nao");
				break;
			}
		}
	}
}
